//
//  DYJShortContentTableViewCell.m
//  Piece
//
//  Created by dllo on 16/6/7.
//  Copyright © 2016年 Northeast Dianli University. All rights reserved.
//

#import "DYJShortContentTableViewCell.h"


@implementation DYJShortContentTableViewCell
- (void)awakeFromNib {
    [super awakeFromNib];
    self.shortContentTextView.font = [UIFont systemFontOfSize:14];
    [self.shortContentTextView setUserInteractionEnabled:NO];
   
}
- (void)setModel:(DYJShortContentModel *)model
{
    if (_model != model) {
        _model = model;
        NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithData:[model.hp_content dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
        NSRange range = NSMakeRange(0, attributedString.length);
        [attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:range];
        self.shortContentTextView.attributedText = attributedString;
//        NSString *contentStr = [attributedString string];
//        self.shortContentTextView.text = contentStr;
//        NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:16], NSFontAttributeName, nil];
//        CGRect rect = [contentStr boundingRectWithSize:CGSizeMake(ScreenWidth - 30, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:dic context:nil];
//        
//        self.shortContentTextView.frame = CGRectMake(10, 10, ScreenWidth - 20, rect.size.height);

    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
